package com.zsrt.java.day20161226.lh.day161226.demo13;

public class Demo {
	public static void main(String[] args) {
		System.out.println(addGJ(2,2,2,2,2));
	}

	/**
	 * 可变形参
	 * @param x
	 * @return
	 */
	public static int addGJ(int... xs){
		
		int sum=0;
		int len=xs.length;
		for(int index=0;index<=len-1;index++){
			int value = xs[index];
			sum=sum+value;
		}
		return sum;
		
	}
	
	
	public static int add(int x,int y){
		return x+y;
	}
	public static int add(int x,int y,int z){
		return x+y+z;
	}
	
}
